# Contributor: Gennady Feldman <gena01@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-rdkafka
_extname=rdkafka
pkgver=6.0.3
pkgrel=2
pkgdesc="A librdkafka bindings for PHP 8.1 providing a working client for Kafka - PECL"
url="https://pecl.php.net/package/rdkafka"
arch="all"
license="MIT"
depends="php81-common"
makedepends="php81-dev file librdkafka-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

build() {
	phpize81
	./configure --prefix=/usr --with-php-config=/usr/bin/php-config81
	make
}

check() {
	php81 -dextension=modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php81/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
0a40cd24e68360f98c2ad941acae2ced55c13ebe6398274c7c127df18fa0181acb73be32d8eba4b0af3016ab7aead3cda516171ac388b10cd5d70fa3b22ed90d  php-pecl-rdkafka-6.0.3.tgz
"
